<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/dxl/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/dxl/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/dxl/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/dxl/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/dxl/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/dxl/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/dxl/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/dxl/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/dxl/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="爬虫,">










<meta name="description" content="一、数据分析1.1什么是数据分析1是把隐藏在一些看似杂乱无章的数据背后的信息提炼出来，总结出所研究对象的内在规律  1.2数据分析三件客1Numpy,Pandas,Matplotlib  1.3数据类型123456ndarray数据类型：dtype：布尔型：bool_整型：int_ int8 int16 int32 int64无符号整型：uint8 uint16 uint32 uint64浮点型：">
<meta name="keywords" content="爬虫">
<meta property="og:type" content="article">
<meta property="og:title" content="数据分析numpy">
<meta property="og:url" content="http://yoursite.com/2019/09/20/【数据分析01】数据分析一/index.html">
<meta property="og:site_name" content="我的快乐时光">
<meta property="og:description" content="一、数据分析1.1什么是数据分析1是把隐藏在一些看似杂乱无章的数据背后的信息提炼出来，总结出所研究对象的内在规律  1.2数据分析三件客1Numpy,Pandas,Matplotlib  1.3数据类型123456ndarray数据类型：dtype：布尔型：bool_整型：int_ int8 int16 int32 int64无符号整型：uint8 uint16 uint32 uint64浮点型：">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-09-20T12:32:15.180Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="数据分析numpy">
<meta name="twitter:description" content="一、数据分析1.1什么是数据分析1是把隐藏在一些看似杂乱无章的数据背后的信息提炼出来，总结出所研究对象的内在规律  1.2数据分析三件客1Numpy,Pandas,Matplotlib  1.3数据类型123456ndarray数据类型：dtype：布尔型：bool_整型：int_ int8 int16 int32 int64无符号整型：uint8 uint16 uint32 uint64浮点型：">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/dxl/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2019/09/20/【数据分析01】数据分析一/">





  <title>数据分析numpy | 我的快乐时光</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/dxl/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">我的快乐时光</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/dxl/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/dxl/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/dxl/2019/09/20/【数据分析01】数据分析一/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content>
      <meta itemprop="description" content>
      <meta itemprop="image" content="/dxl/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="我的快乐时光">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">数据分析numpy</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-09-20T20:44:46+08:00">
                2019-09-20
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/dxl/categories/爬虫/" itemprop="url" rel="index">
                    <span itemprop="name">爬虫</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/dxl/2019/09/20/【数据分析01】数据分析一/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/dxl/2019/09/20/【数据分析01】数据分析一/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv">本文总阅读量
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>次
            </span>
          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="一、数据分析"><a href="#一、数据分析" class="headerlink" title="一、数据分析"></a>一、数据分析</h2><h3 id="1-1什么是数据分析"><a href="#1-1什么是数据分析" class="headerlink" title="1.1什么是数据分析"></a>1.1什么是数据分析</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">是把隐藏在一些看似杂乱无章的数据背后的信息提炼出来，总结出所研究对象的内在规律</span><br></pre></td></tr></table></figure>

<h3 id="1-2数据分析三件客"><a href="#1-2数据分析三件客" class="headerlink" title="1.2数据分析三件客"></a>1.2数据分析三件客</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Numpy,Pandas,Matplotlib</span><br></pre></td></tr></table></figure>

<h3 id="1-3数据类型"><a href="#1-3数据类型" class="headerlink" title="1.3数据类型"></a>1.3数据类型</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">ndarray数据类型：dtype：</span><br><span class="line">布尔型：bool_</span><br><span class="line">整型：int_ int8 int16 int32 int64</span><br><span class="line">无符号整型：uint8 uint16 uint32 uint64</span><br><span class="line">浮点型：float_ float16 float32 float64</span><br><span class="line">复数型：complex_ complex64 complex128</span><br></pre></td></tr></table></figure>

<h2 id="二、NumPy"><a href="#二、NumPy" class="headerlink" title="二、NumPy"></a>二、NumPy</h2><p>​        NumPy(Numerical Python) 是 Python 语言的一个扩展程序库，支持大量的维度数组与矩阵运算，此外也针对数组运算提供大量的数学函数库。</p>
<h3 id="2-1创建ndarrpy"><a href="#2-1创建ndarrpy" class="headerlink" title="2.1创建ndarrpy"></a>2.1创建ndarrpy</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">创建ndarray：</span><br><span class="line">    array()         将列表转换为数组，可选择显式指定dtype</span><br><span class="line">    arange()        range的numpy版，支持浮点数</span><br><span class="line">    linspace()      类似arange()，第三个参数为数组长度</span><br><span class="line">    zeros()         根据指定形状和dtype创建全0数组</span><br><span class="line">    ones()          根据指定形状和dtype创建全1数组</span><br><span class="line">    empty()         根据指定形状和dtype创建空数组（随机值）</span><br><span class="line">    eye()           根据指定边长和dtype创建单位矩阵</span><br></pre></td></tr></table></figure>

<p>1、一维数组的创建</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line">arrry = np.array([<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>])</span><br><span class="line">print(arrry) <span class="comment"># [1 2 3 4 5 6]</span></span><br></pre></td></tr></table></figure>

<p>2、二维数组的创建</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line">arrry = np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line">print(arrry) </span><br><span class="line"><span class="comment">#结果</span></span><br><span class="line"><span class="comment"># [[1 2 3]</span></span><br><span class="line"><span class="comment">#  [4 5 6]]</span></span><br><span class="line">arrry = np.array([[<span class="string">'1.1'</span>,<span class="number">2</span>,<span class="number">3</span>,],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line">print(arrry)</span><br><span class="line"><span class="comment">#结果</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[['1.1' '2' '3']</span></span><br><span class="line"><span class="string"> ['4' '5' '6']]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="comment">#注意事项</span></span><br><span class="line">numpy默认ndarray的所有元素的类型是相同的</span><br><span class="line">如果传进来的列表中包含不同的类型，则统一为同一类型，优先级：str&gt;float&gt;int</span><br></pre></td></tr></table></figure>

<p>3、使用np的routines函数创建</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#np.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None) 等差数列</span></span><br><span class="line">np.linspace(<span class="number">1</span>,<span class="number">100</span>,num=<span class="number">20</span>)</span><br><span class="line"><span class="comment">#np.arange([start, ]stop, [step, ]dtype=None)</span></span><br><span class="line">np.arange(<span class="number">0</span>,<span class="number">100</span>,step=<span class="number">2</span>)</span><br><span class="line"><span class="comment"># np.random.randint(low, high=None, size=None, dtype='l')</span></span><br><span class="line">np.random.seed(<span class="number">10</span>)  <span class="comment">#随机因子/时间种子</span></span><br><span class="line">np.random.randint(<span class="number">0</span>,<span class="number">100</span>,size=(<span class="number">4</span>,<span class="number">5</span>)) <span class="comment">#没有随机英子，结果会发生改变，有了随机英子，结果就不会发生改变</span></span><br><span class="line"><span class="comment">#结果</span></span><br><span class="line">[[ <span class="number">9</span> <span class="number">36</span> <span class="number">15</span>  <span class="number">0</span> <span class="number">49</span>]</span><br><span class="line"> [<span class="number">28</span> <span class="number">25</span> <span class="number">29</span> <span class="number">48</span> <span class="number">29</span>]</span><br><span class="line"> [<span class="number">49</span>  <span class="number">8</span>  <span class="number">9</span>  <span class="number">0</span> <span class="number">42</span>]</span><br><span class="line"> [<span class="number">40</span> <span class="number">36</span> <span class="number">16</span> <span class="number">36</span> <span class="number">47</span>]]</span><br></pre></td></tr></table></figure>

<h3 id="2-2-ndarray的属性"><a href="#2-2-ndarray的属性" class="headerlink" title="2.2 ndarray的属性"></a>2.2 ndarray的属性</h3><p>1、 ndim：维度 shape：形状（各维度的长度） size：总长度</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">arr =  np.array([[<span class="string">'1.1'</span>,<span class="number">2</span>,<span class="number">3</span>,],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line">print(arr.ndim) <span class="comment"># 2</span></span><br><span class="line">print(arr.size) <span class="comment">#6</span></span><br><span class="line">print(arr.shape) <span class="comment"># (2, 3)</span></span><br><span class="line">print(arr.dtype) <span class="comment"># &lt;U3</span></span><br></pre></td></tr></table></figure>

<h3 id="2-3-ndarray的基本操作"><a href="#2-3-ndarray的基本操作" class="headerlink" title="2.3 ndarray的基本操作"></a>2.3 ndarray的基本操作</h3><p>常用方法</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">array.shape                         array的规格</span><br><span class="line">array.ndim      </span><br><span class="line">array.dtype                         array的数据规格</span><br><span class="line">numpy.zeros(dim1,dim2)              创建dim1*dim2的零矩阵</span><br><span class="line">numpy.arange</span><br><span class="line">numpy.eye(n) /numpy.identity(n)     创建n*n单位矩阵</span><br><span class="line">numpy.array([…data…], dtype=float64 )</span><br><span class="line">array.astype(numpy.float64)         更换矩阵的数据形式</span><br><span class="line">array.astype(float)                 更换矩阵的数据形式</span><br><span class="line">array * array                       矩阵点乘</span><br><span class="line">array[a:b]                          切片</span><br><span class="line">array.copy()                        得到ndarray的副本，而不是视图</span><br><span class="line">array [a] [b]=array [ a, b ]        两者等价</span><br><span class="line">name=np.array([<span class="string">'bob'</span>,<span class="string">'joe'</span>,<span class="string">'will'</span>]) res=name==’bob’ res= array([ <span class="literal">True</span>, <span class="literal">False</span>, <span class="literal">False</span>], dtype=bool)</span><br><span class="line">data[<span class="literal">True</span>,<span class="literal">False</span>,…..]                索引，只索取为<span class="literal">True</span>的部分，去掉<span class="literal">False</span>部分</span><br><span class="line">通过布尔型索引选取数组中的数据，将总是创建数据的副本。</span><br><span class="line">data[ [<span class="number">4</span>,<span class="number">3</span>,<span class="number">0</span>,<span class="number">6</span>] ]                   索引，将第<span class="number">4</span>,<span class="number">3</span>,<span class="number">0</span>,<span class="number">6</span>行摘取出来，组成新数组</span><br><span class="line">data[<span class="number">-1</span>]=data[data.__len__()<span class="number">-1</span>]</span><br><span class="line">numpy.reshape(a,b)                  将a*b的一维数组排列为a*b的形式</span><br><span class="line">array([a,b,c,d],[d,e,f,g])          返回一维数组，分别为[a,d],[b,e],[c,f],[d,g]</span><br><span class="line">array[ [a,b,c,d] ][:,[e,f,g,h] ]=array[ numpy.ix_( [a,b,c,d],[e,f,g,h] ) ]</span><br><span class="line">array.T                             array的转置</span><br><span class="line">numpy.random.randn(a,b)             生成a*b的随机数组</span><br><span class="line">numpy.dot(matrix_1,matrix_2)        矩阵乘法</span><br><span class="line">array.transpose( (<span class="number">1</span>,<span class="number">0</span>,<span class="number">2</span>,etc.) )     对于高维数组，转置需要一个由轴编号组成的元组</span><br></pre></td></tr></table></figure>

<p>1、索引</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">arr = np.random.randint(<span class="number">1</span>,<span class="number">50</span>,size=(<span class="number">4</span>,<span class="number">5</span>))</span><br><span class="line"><span class="number">1</span>、去所有</span><br><span class="line">print(arr) </span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[22 12 47 48 21]</span></span><br><span class="line"><span class="string"> [17 20 45  9 13]</span></span><br><span class="line"><span class="string"> [ 6 46 30 13 23]</span></span><br><span class="line"><span class="string"> [48  6 36 17 24]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">2</span>、第一行和第二行</span><br><span class="line">print(arr[[<span class="number">1</span>,<span class="number">2</span>]])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[17 20 45  9 13]</span></span><br><span class="line"><span class="string"> [ 6 46 30 13 23]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">3</span>、第一行</span><br><span class="line">print(arr[<span class="number">1</span>])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string"> [17 20 45  9 13]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">4</span>、取元素（第一行第二列）</span><br><span class="line">print(arr[<span class="number">1</span>,<span class="number">2</span>])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">45</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="comment">#其他操作</span></span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line">a = np.array([<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">4</span>,<span class="number">7</span>,<span class="number">8</span>,<span class="number">9</span>,<span class="number">10</span>])</span><br><span class="line"><span class="comment">#给一个数组，选出数组中所有大于5的数</span></span><br><span class="line">a[a&gt;<span class="number">5</span>]</span><br><span class="line"><span class="comment">#给一个数组，选出数组中所有大于5的偶数	</span></span><br><span class="line">a[(a&gt;<span class="number">5</span>) &amp; (a%<span class="number">2</span>==<span class="number">0</span>)]</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">array([ 1,  2,  3,  4,  5,  4,  7,  8,  9, 10])</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="comment">#给一个数组，选出数组中所有大于5的数和偶	</span></span><br><span class="line">a[(a&gt;<span class="number">5</span>) | (a%<span class="number">2</span>==<span class="number">0</span>)]</span><br></pre></td></tr></table></figure>

<p>2、切片</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">arr = np.random.randint(<span class="number">1</span>,<span class="number">50</span>,size=(<span class="number">4</span>,<span class="number">5</span>))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[36 41 10 48 39]</span></span><br><span class="line"><span class="string"> [39 11 45 21 26]</span></span><br><span class="line"><span class="string"> [39 15 12  6 25]</span></span><br><span class="line"><span class="string"> [ 6 24  3  6  2]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">1</span>、前两行</span><br><span class="line">print(arr[<span class="number">0</span>:<span class="number">2</span>])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[36 41 10 48 39]</span></span><br><span class="line"><span class="string"> [39 11 45 21 26]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">2</span>、前两列</span><br><span class="line">print(arr[:,:<span class="number">2</span>])</span><br><span class="line"><span class="comment">#qu第一列和第三列arr[:,[1,3]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[36 41]</span></span><br><span class="line"><span class="string"> [39 11]</span></span><br><span class="line"><span class="string"> [39 15]</span></span><br><span class="line"><span class="string"> [ 6 24]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">3</span>、行到序</span><br><span class="line">print(arr[::<span class="number">-1</span>])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[ 6 24  3  6  2]</span></span><br><span class="line"><span class="string"> [39 15 12  6 25]</span></span><br><span class="line"><span class="string"> [39 11 45 21 26]</span></span><br><span class="line"><span class="string"> [36 41 10 48 39]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">4</span>、列到序</span><br><span class="line">print(arr[:,::,<span class="number">-1</span>])</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[ 6 24  3  6  2]</span></span><br><span class="line"><span class="string"> [39 15 12  6 25]</span></span><br><span class="line"><span class="string"> [39 11 45 21 26]</span></span><br><span class="line"><span class="string"> [36 41 10 48 39]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">5</span>、反转</span><br><span class="line">print(arr[::<span class="number">-1</span>,::<span class="number">-1</span>])</span><br></pre></td></tr></table></figure>

<p>3、变形</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1</span>、一维数组转为多维数组</span><br><span class="line">arr = np.array([<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>])</span><br><span class="line">print(arr)</span><br><span class="line">print(arr.reshape((<span class="number">-1</span>,<span class="number">3</span>)))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[1 2 3]</span></span><br><span class="line"><span class="string"> [4 5 6]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">2</span>、多维数组转为一维数组</span><br><span class="line"><span class="comment"># arr1 =np.array([[1,2,3],[4,5,6]])</span></span><br><span class="line"><span class="comment"># print(arr1.reshape((6,)))</span></span><br><span class="line"><span class="number">3</span>、注意事项</span><br><span class="line">	多维数组和一维数组的长度必须相等</span><br><span class="line">    一维数组/多维数组 必须是整数</span><br></pre></td></tr></table></figure>

<p>4、级联</p>
<p>​            就是对多个numpy数据进行横向或者纵向的拼接</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#列的合并 axis 0 列的合并 1 行的合并</span></span><br><span class="line">arr1 =np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line">arr1 =np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line">print(np.concatenate((arr1,arr1), axis=<span class="number">0</span>))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[1 2 3]</span></span><br><span class="line"><span class="string"> [4 5 6]</span></span><br><span class="line"><span class="string"> [1 2 3]</span></span><br><span class="line"><span class="string"> [4 5 6]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line">print(np.concatenate((arr1,arr1), axis=<span class="number">1</span>))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[1 2 3 1 2 3]</span></span><br><span class="line"><span class="string"> [4 5 6 4 5 6]]</span></span><br><span class="line"><span class="string">"""</span></span><br></pre></td></tr></table></figure>

<h3 id="2-4-ndarray的聚合操作"><a href="#2-4-ndarray的聚合操作" class="headerlink" title="2.4 ndarray的聚合操作"></a>2.4 ndarray的聚合操作</h3><p>1、求和np.sum</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">arr1 =np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line"><span class="comment">#总和</span></span><br><span class="line">print(arr1.sum()) <span class="comment">#21</span></span><br><span class="line"><span class="comment">#列求和</span></span><br><span class="line">print(arr1.sum(axis=<span class="number">1</span>)) <span class="comment">#[5 7 9]</span></span><br><span class="line"><span class="comment">#行求和</span></span><br><span class="line">print(arr1.sum(axis=<span class="number">0</span>)) <span class="comment">#[ 6 15]</span></span><br></pre></td></tr></table></figure>

<p>2、 最大最小值：np.max/ np.min</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">arr1 =np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line"><span class="comment">#最小值</span></span><br><span class="line">print(arr1.min()) <span class="comment">#1</span></span><br><span class="line"><span class="comment">#行小值</span></span><br><span class="line">print(arr1.min(axis=<span class="number">1</span>)) <span class="comment">#[1 4]</span></span><br><span class="line"><span class="comment">#列最小值</span></span><br><span class="line">print(arr1.min(axis=<span class="number">0</span>)) <span class="comment">#[1 2 3]</span></span><br></pre></td></tr></table></figure>

<p>3、平均值：np.mean()</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">arr1 =np.array([[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>],[<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>]])</span><br><span class="line"><span class="comment">#平均值</span></span><br><span class="line">print(arr1.min()) <span class="comment">#3.5</span></span><br><span class="line"><span class="comment">#行平均值</span></span><br><span class="line">print(arr1.min(axis=<span class="number">1</span>)) <span class="comment">#[2. 5.]</span></span><br><span class="line"><span class="comment">#列平均值</span></span><br><span class="line">print(arr1.min(axis=<span class="number">0</span>)) <span class="comment">#[2.5 3.5 4.5]</span></span><br></pre></td></tr></table></figure>

<h3 id="2-5-ndarry的排序"><a href="#2-5-ndarry的排序" class="headerlink" title="2.5 ndarry的排序"></a>2.5 ndarry的排序</h3><p>1、快速排序</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">arr = np.random.randint(<span class="number">1</span>,<span class="number">100</span>,size=(<span class="number">4</span>,<span class="number">5</span>))</span><br><span class="line">print(arr)</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[45 45 74 56 68]</span></span><br><span class="line"><span class="string"> [56 92 44 58 60]</span></span><br><span class="line"><span class="string"> [93 91 27 40 89]</span></span><br><span class="line"><span class="string"> [70 12 12 73 34]]</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">1</span>、行排序</span><br><span class="line">print(np.sort(arr,axis=<span class="number">0</span>))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[45 12 12 40 34]</span></span><br><span class="line"><span class="string"> [56 45 27 56 60]</span></span><br><span class="line"><span class="string"> [70 91 44 58 68]</span></span><br><span class="line"><span class="string"> [93 92 74 73 89]]</span></span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="number">2</span>、列排序</span><br><span class="line">print(np.sort(arr,axis=<span class="number">1</span>))</span><br><span class="line"><span class="string">"""</span></span><br><span class="line"><span class="string">[[45 45 56 68 74]</span></span><br><span class="line"><span class="string"> [44 56 58 60 92]</span></span><br><span class="line"><span class="string"> [27 40 89 91 93]</span></span><br><span class="line"><span class="string"> [12 12 34 70 73]]</span></span><br><span class="line"><span class="string">"""</span></span><br></pre></td></tr></table></figure>

<h2 id="三、总结"><a href="#三、总结" class="headerlink" title="三、总结"></a>三、总结</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line">#常用函数</span><br><span class="line">Function Name    NaN-safe Version    Description</span><br><span class="line">np.sum    np.nansum    Compute sum of elements</span><br><span class="line">np.prod    np.nanprod    Compute product of elements</span><br><span class="line">np.mean    np.nanmean    Compute mean of elements</span><br><span class="line">np.std    np.nanstd    Compute standard deviation</span><br><span class="line">np.var    np.nanvar    Compute variance</span><br><span class="line">np.min    np.nanmin    Find minimum value</span><br><span class="line">np.max    np.nanmax    Find maximum value</span><br><span class="line">np.argmin    np.nanargmin    Find index of minimum value</span><br><span class="line">np.argmax    np.nanargmax    Find index of maximum value</span><br><span class="line">np.median    np.nanmedian    Compute median of elements</span><br><span class="line">np.percentile    np.nanpercentile    Compute rank-based statistics of elements</span><br><span class="line">np.any    N/A    Evaluate whether any elements are true</span><br><span class="line">np.all    N/A    Evaluate whether all elements are true</span><br><span class="line">np.power 幂运算</span><br><span class="line">#一元函数</span><br><span class="line">numpy.sqrt(array)                   平方根函数   </span><br><span class="line">numpy.exp(array)                    e^array[i]的数组</span><br><span class="line">numpy.abs/fabs(array)               计算绝对值</span><br><span class="line">numpy.square(array)                 计算各元素的平方 等于array**2</span><br><span class="line">numpy.log/log10/log2(array)         计算各元素的各种对数</span><br><span class="line">numpy.sign(array)                   计算各元素正负号</span><br><span class="line">numpy.isnan(array)                  计算各元素是否为NaN</span><br><span class="line">numpy.isinf(array)                  计算各元素是否为NaN</span><br><span class="line">numpy.cos/cosh/sin/sinh/tan/tanh(array) 三角函数</span><br><span class="line">numpy.modf(array)                   将array中值得整数和小数分离，作两个数组返回</span><br><span class="line">numpy.ceil(array)                   向上取整,也就是取比这个数大的整数 </span><br><span class="line">numpy.floor(array)                  向下取整,也就是取比这个数小的整数</span><br><span class="line">numpy.rint(array)                   四舍五入</span><br><span class="line">numpy.trunc(array)                  向0取整 </span><br><span class="line">numpy.cos(array)                       正弦值</span><br><span class="line">numpy.sin(array)                    余弦值 </span><br><span class="line">numpy.tan(array) </span><br><span class="line">#二元函数</span><br><span class="line">numpy.add(array1,array2)            元素级加法</span><br><span class="line">numpy.subtract(array1,array2)       元素级减法</span><br><span class="line">numpy.multiply(array1,array2)       元素级乘法</span><br><span class="line">numpy.divide(array1,array2)         元素级除法 array1./array2</span><br><span class="line">numpy.power(array1,array2)          元素级指数 array1.^array2</span><br><span class="line">numpy.maximum/minimum(array1,aray2) 元素级最大值</span><br><span class="line">numpy.fmax/fmin(array1,array2)      元素级最大值，忽略NaN</span><br><span class="line">numpy.mod(array1,array2)            元素级求模</span><br><span class="line">numpy.copysign(array1,array2)       将第二个数组中值得符号复制给第一个数组中值</span><br><span class="line">numpy.greater/greater_equal/less/less_equal/equal/not_equal (array1,array2)</span><br><span class="line">元素级比较运算，产生布尔数组</span><br><span class="line">numpy.logical_end/logical_or/logic_xor(array1,array2)元素级的真值逻辑运算</span><br><span class="line">#随机生成</span><br><span class="line">rand	给定形状产生随机数组（0到1之间的数）</span><br><span class="line">randint	给定形状产生随机整数</span><br><span class="line">choice	给定形状产生随机选择</span><br><span class="line">shuffle	与random.shuffle相同</span><br><span class="line">uniform	给定形状产生随机数组</span><br></pre></td></tr></table></figure>


      
    </div>
    
    
    

    

    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://yoursite.com/2019/09/20/【数据分析01】数据分析一/" title="数据分析numpy">http://yoursite.com/2019/09/20/【数据分析01】数据分析一/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/dxl/tags/爬虫/" rel="tag"># 爬虫</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/dxl/2019/09/20/【爬虫12】数据的异步爬取/" rel="next" title="异步爬虫">
                <i class="fa fa-chevron-left"></i> 异步爬虫
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/dxl/2019/09/20/【数据分析02】数据分析二/" rel="prev" title="数据分析pandas">
                数据分析pandas <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/dxl/images/avatar.png" alt>
            
              <p class="site-author-name" itemprop="name"></p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/dxl/archives">
              
                  <span class="site-state-item-count">43</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/dxl/categories/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/dxl/tags/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-inline">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-sign-out"></i>
                我的友链
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="tencent://message/?Menu=yes&uin=1258517737&Site=QQ%E6%9E%81%E5%AE%A2&Service=300&sigT=45a1e5847943b64c6ff3990f8a9e644d2b31356cb0b4ac6b24663a3c8dd0f8aa12a595b1714f9d45/" title="申请坑位" target="_blank">申请坑位</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#一、数据分析"><span class="nav-number">1.</span> <span class="nav-text">一、数据分析</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1什么是数据分析"><span class="nav-number">1.1.</span> <span class="nav-text">1.1什么是数据分析</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2数据分析三件客"><span class="nav-number">1.2.</span> <span class="nav-text">1.2数据分析三件客</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3数据类型"><span class="nav-number">1.3.</span> <span class="nav-text">1.3数据类型</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二、NumPy"><span class="nav-number">2.</span> <span class="nav-text">二、NumPy</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1创建ndarrpy"><span class="nav-number">2.1.</span> <span class="nav-text">2.1创建ndarrpy</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-ndarray的属性"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 ndarray的属性</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-ndarray的基本操作"><span class="nav-number">2.3.</span> <span class="nav-text">2.3 ndarray的基本操作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-ndarray的聚合操作"><span class="nav-number">2.4.</span> <span class="nav-text">2.4 ndarray的聚合操作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-ndarry的排序"><span class="nav-number">2.5.</span> <span class="nav-text">2.5 ndarry的排序</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#三、总结"><span class="nav-number">3.</span> <span class="nav-text">三、总结</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-hand-peace-o"></i>
  </span>
  <span class="author" itemprop="copyrightHolder"></span>

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      本站访客数
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      人次
    </span>
  

  
    <span class="site-pv">
      本站总访问量
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>








        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/dxl/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/dxl/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/dxl/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/dxl/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/dxl/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/dxl/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/dxl/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/dxl/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/dxl/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/dxl/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/dxl/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/dxl/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/dxl/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: '13B0JGDuA6ttduN8AQaR8CzF-gzGzoHsz',
        appKey: 'I13r9r5mVgq4jQYpYy6V4gW3',
        placeholder: '欢迎大佬指点~~~',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  





  

  

  

  
  

  

  

  

</body>
</html>
